#include <reg52.h>
#include <intrins.h>

//#define uchar unsigned char
#define uint unsigned int

void delayms(unsigned int xms)
{
    unsigned int i,j;
    for(i=xms;i>0;i--)
        for(j=114;j>0;j--);
}

void main()
{
    uint aa;
	aa = 0x7f;//0111 1111
	while(1)
	{
		aa = _cror_(aa,1);
		while(aa == 0xfe)
		{
			while(aa != 0x7f)
			{
				P1 = aa;
				aa = _crol_(aa,1);
				delayms(500);
			}
		}
		P1 =aa;
		delayms(500);
	}
}
